#{extends 'overlay.html' /}
#{set title:'Create new project' /}

<div id="crudBlank" class="${type.name}">

<script type="text/javascript">

function checkAvailability(){

var n = document.getElementById('object_name').value;
$.post('@{checkAvailability()}',{name:n},function (flag) {
if(n){
if(!flag){
document.getElementById("isAvailable").innerHTML = "("+n+") is Available.";
document.getElementById("isAvailable").setAttribute("style","color:green");
}
else{
document.getElementById("isAvailable").innerHTML = "("+n+") is Unavailable.";
document.getElementById("isAvailable").setAttribute("style","color:red");
}
}
else{
document.getElementById("isAvailable").innerHTML = "Please Enter a Valid Name.";
document.getElementById("isAvailable").setAttribute("style","color:red");
}
var div=document.getElementById("er");
div.style.display="none";

},'json')

}

function changetext(obj){

	 if(obj.innerHTML=="Toggle more options")
	 obj.innerHTML="Toggle less options";
	 else
	 obj.innerHTML="Toggle more options"
}

</script>

			<h1 id="crudBlankTitle" >Create a New Project </h1>

<div style="padding: 10px 10px 10px 10px;" class="ui-state-highlight ui-corner-all"> 
	<span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span>
To Create a Project , You Must make sure the name you enter is available.
</div>
	<div id="y" class="objectForm">
	#{form action:@create(), enctype:'multipart/form-data'}
		<div class="crudField"> 
			<label for="object_name"> 
			Name <span class="crudHelp" style="color:red"> *	</span>
			</label> <br/>
			<input id="object_name" class="" type="text" name="object.name" value="" size="50" /> 			
			<input type="button" name="_available" value="Check Availability" onclick="checkAvailability()" />
			<b><label id="isAvailable"></label></b>
			
		</div> 
 		<a onclick="changetext(this);$('.moreOptions').toggle()">Toggle more options</a>
		<div class="crudField moreOptions hidden">
			<label for="object_description"> 
				Description
			</label> <br/>
			<textarea id="object_description" name="object.description" cols="53" rows="5"  /></textarea>
		</div>
		
		
		
		<div class="crudField hidden">
		<input type="checkbox" name="object_isScrum" checked="checked">
			<label for="object_isScrum">Check this box if this is a SCRUM project</label>
		</div>

		
		<p class="crudButtons">
			<input type="submit" name="_save" value="Create Project"  onclick=""/>
		</p>
		
	#{/form}

	</div>

</div>

	
